package lapsnake.model.dnd;

import java.awt.Point;
import java.util.ArrayList;

import javax.swing.JPanel;

import lapsnake.model.LapNode;

public abstract class NodePanel<T extends LapNode> extends JPanel
{
	private static final long serialVersionUID = -8366414718602244716L;
	
	public final T node;
	public final StmtPanel rootPanel;
	
	public NodePanel(StmtPanel rootPanel, T node)
	{
		this.rootPanel = rootPanel;
		this.node = node;
	}
	public abstract void getChildPanels(ArrayList<NodePanel<?>> builder);
	/**
	 * Returns the appropriate socket for the given point, in the absolute drag and drop space.
	 * <br>
	 * Note that the returned socket may be a socket belonging to a different node/panel!
	 */
	public abstract Socket getSocketAt(Point p);
	
	/**Returns the point, inside the root of the drag and drop UI, where this panel has its origin(northwest-point).*/
	public abstract Point getAbsoluteLocation();
	/**Called when creating a panel for a ChildField for this panel's node.*/
	public abstract void registerFieldPanel(FieldPanel fieldPanel);
	
	public StmtPanel getRootPanel()
	{
		return rootPanel;
	}
}